package com.erps.config;

import java.util.List;

import com.erps.CommonUtils.AppConfig;
import com.erps.CommonUtils.StringEx;
import com.erps.model.ResRequestModel;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;

public class ResRequest {
	public void request(Controller c,String templetName,String req_status){
		ResRequestModel request = c.getModel(ResRequestModel.class);
		
			
		int pageNumber = StringEx.getInt(c.getPara("pagenumber"), 1);
		int pageSize = StringEx.getInt(c.getPara("pagesize"), 10);
		String user_id = StringEx.getStr(c.getSessionAttr(AppConfig.SESSION_USERID));
		
		Page<ResRequestModel> page = request.paginate(pageNumber, pageSize,user_id,req_status);
		List<ResRequestModel> res_list = page.getList();
		int pages = page.getTotalPage();
				
		c.setAttr("res_list", res_list);
		c.setAttr("pages", pages);
		c.render(templetName);
	}
}
